<?php
class Zen_Uri extends Zen_Base
{

    // 获得当前请求的URL
    public static function currUrl()
    {
        $protocol = strpos(strtolower($_SERVER['SERVER_PROTOCOL']),'https')
                     === FALSE ? 'http' : 'https';
        $host     = $_SERVER['HTTP_HOST'];
        $port = ($_SERVER['SERVER_PORT'] == 80 || $_SERVER['SERVER_PORT'] == 443) ? '' : ':'.$_SERVER['SERVER_PORT'];
        $script   = $_SERVER['SCRIPT_NAME'];
        $params   = empty($_SERVER['QUERY_STRING'])?'':'?'.$_SERVER['QUERY_STRING'];
        return $protocol.'://'.$host.$port.$script.$params;
    }
}